package org.csu.demo.domain;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

@Data
@TableName("product")
public class Product {

    @NotBlank(message = "productId不能为空")
    @TableId("productid")
    private String productId;
    //category的值必须与Category中的一致
    @NotBlank(message = "产品的类别不能为空")
    private String category;
    @NotBlank(message = "产品名不能为空")
    private String name;
    @TableField("descn")
    private String description;

    @TableLogic
    @JsonIgnore
    private Integer deleted;

    @JsonIgnore
    public boolean isAllNull(){
        if(this.category !=null ||this.name !=null ||this.description !=null){
            return false;
        }else {
            return true;
        }
    }
}
